package com.star.spring.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.star.spring.entity.UserEntity;
import com.star.spring.model.UserSearchDTO;
import com.star.spring.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName UserController
 * @Author star
 * @Date 2024/7/14 18:35
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping
    public Boolean create(@RequestBody UserEntity saveReq) {

        int i = userService.mapperSave(saveReq);
        return true;
    }


    @GetMapping("")
    public IPage<UserEntity> page(Page<UserEntity> page, UserSearchDTO searchDTO) {

        return userService.pageEntity(page, searchDTO);
    }


}
